#include<bits/stdc++.h>
using i64 = long long;
const int MOD = 998244353;
#define ull unsigned long long
using namespace std;

const int N = 1e6 + 10, INF = 0x3f3f3f3f;

i64 sumh=0, sumx=1,n,k,ans;
i64 a[N];

i64 qmi(i64 a, i64 b)
{
    i64 res = 1 % MOD;
    while (b) {
        if (b & 1) {
            res = res * a % MOD;
        }
        a = a * a % MOD;
        b >>= 1;
    }
    return res;
}

void solve()
{
    cin >> n >> k;
    for (int i = 1;i <= n;i++) {
        cin >> a[i];
        sumh =(sumh+a[i])%MOD;
        sumx =(sumx*a[i])%MOD;
    }
    string s;
    cin >> s;
    if (s[s.size() - 1] == 's') {
        ans = sumh;
    }
    else {
        ans = sumx;
    }
    //cout <<"sumh"<<sumh<<"ans: "<< ans << endl;
    for (int i = s.size() - 2;i >= 0;i--) {
        if (s[i] == 'p') {
            ans =qmi(ans, n)%MOD;
        }
        else {
            ans = (ans * n) % MOD;
        }
    }
    cout << ans << endl;
}

signed main()
{
    // ios::sync_with_stdio(0);
    // cin.tie(0);cout.tie(0);
#define ONLINE_JUDGE
#ifndef ONLINE_JUDGE
    std::istringstream in(R"()");
    std::cin.rdbuf(in.rdbuf());
#endif
    int T = 1;
    //cin>>T;
    for (int i = 1;i <= T;i++) {
        solve();
    }
}